<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button @click="msg=111">修改了</button>
        <button @click="obj.age++">修改了</button>
        {{msg}}
        <p>
            {{obj.name}} {{obj.age}}
        </p>
    </div>
</body>
<script src="./vue.min.js"></script>
<script>
  let vm =  new Vue({
        el:"#app",
        data:{
            msg:"哈哈哈",
            obj:{
                name:"张三",
                age:10
            }
        },
    })

    vm.$watch("msg",()=>{
        console.log("修改了");
    })
    vm.$watch("obj",()=>{
        console.log("对象被修改了");
    },{
        deep:true
    })
</script>
</html>